import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { TypeOrmModule } from '@nestjs/typeorm';
import { GraphQLModule } from '@nestjs/graphql';
import { SystemModule } from './modules/system/system.module';
import { AuthModule } from './modules/common/auth/auth.module';
import { SharedModule } from './modules/shared/shared.module';
import { ServeStaticModule } from '@nestjs/serve-static';
import { join } from 'path';

@Module({
  imports: [ TypeOrmModule.forRoot({
    type: 'mysql',
    host: '8.129.234.99',
    port: 3306,
    username: 'root',
    password: '123456',
    database: 'ckw_serverless_nest',
    synchronize: true, 
    logging: true,
    entities: [
      __dirname + '/**/*.entity{.ts,.js}'],
  }),
  ServeStaticModule.forRoot({
    rootPath: join(__dirname, '..', 'client'),
  }),
  GraphQLModule.forRoot({
    autoSchemaFile: 'schemal.graphql',
    // context: ({req}) => ({req}),
    // uploads: {
    //   maxFileSize: 10000000, // 10 MB
    //   maxFiles: 1, // 一次上传一张
    // },
    debug: false, 

  }),
  SystemModule,
  AuthModule,SharedModule],
  controllers: [AppController],
  providers: [AppService],
})


export class AppModule {}
